//
//  NSDictionary+BaseFramework.m
//  Project
//
//  Created by Suny on 14-10-12.
//  Copyright (c) 2014年 Suny. All rights reserved.
//

#import "NSDictionary+BaseFramework.h"
#import "NSString+BaseFramework.h"
#import "JSONKit.h"
#import "NSObject+BaseFramework.h"
@implementation NSDictionary (BaseFramework)



- (NSString *)createStringUrlParameter
{
	NSMutableString *resultString = [NSMutableString string];
	
	NSArray *allKeys = [self allKeys];
	
	for (NSString *key in allKeys)
	{
		id value = [self objectForKey:key];
		if ([value isKindOfClass:[NSString class]]||[value isKindOfClass:[NSNumber class]])
		{
			value = [NSString stringWithFormat:@"%@",value];
			[resultString appendString:key];
			[resultString appendString:@"="];
			[resultString appendString:[value urlEncoding]];
//			[resultString appendString:value ];
			[resultString appendString:@"&"];
		}		
		else if ([value isKindOfClass:[NSArray class]])
		{
			NSArray *arrayVaule = value;
			NSString *valueString = [arrayVaule JSONString];

            [resultString appendString:key];
            [resultString appendString:@"="];
            [resultString appendString:[valueString urlEncoding]];
            [resultString appendString:@"&"];
		}
	}
	
	return( resultString == nil || [allKeys count] ==0)  ? @"" : resultString;
}

@end
